package com.ecoolex.hotel.saas.ws;

import com.ecoolex.framework.common.exception.BizException;
import com.ecoolex.framework.common.pojo.Page;
import com.ecoolex.framework.common.pojo.Pagination;
import com.ecoolex.hotel.saas.core.manager.ActivityManager;
import com.ecoolex.hotel.saas.core.manager.ActivityShowStoreManager;
import com.ecoolex.hotel.saas.core.manager.ActivityStoreManager;
import com.ecoolex.hotel.saas.entity.Activity;
import com.ecoolex.hotel.saas.entity.ActivityShowStore;
import com.ecoolex.hotel.saas.entity.ActivityStore;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class ActivityServiceImpl implements ActivityService {

    @Autowired
    private ActivityManager activityManager;

    @Override
    public Activity get(Integer activityId) {
        return activityManager.get(activityId);
    }

    @Override
    public Pagination<Activity> query(String name, Page page) {
        return activityManager.query(name, page);
    }

    @Override
    public Pagination<Activity> queryByShowStoreId(Integer storeId, Page page) {
        return activityManager.queryByShowStoreId(storeId,page);
    }

    @Override
    public Activity add(Activity record, String createUser) throws BizException {
        return activityManager.add(record, createUser);
    }

    @Override
    public Activity edit(Activity record, String updateUser) throws BizException {
        return activityManager.edit(record, updateUser);
    }

    @Override
    public void delete(Activity record, String updateUser) throws BizException {
        activityManager.delete(record, updateUser);
    }

    @Autowired
    private ActivityStoreManager activityStoreManager;

    @Override
    public Integer activityStoreNumber(Integer activityId) {
        return activityStoreManager.queryByActivityId(activityId).size();
    }

    @Override
    public ActivityStore getActivityStore(Integer id) {
        return activityStoreManager.getActivityStore(id);
    }

    @Override
    public Pagination<ActivityStore> queryActivityStore(String storeName, Integer activityId, Page page) {
        return activityStoreManager.queryActivityStore(storeName, activityId, page);
    }

    @Override
    public List<ActivityStore> queryActivityStore(Integer activityId, Integer size) {
        return activityStoreManager.queryActivityStore(activityId,size);
    }

    @Override
    public void addActivityStore(Integer activityId, List<Integer> storeIdList, String createUser) throws BizException {
        activityStoreManager.addActivityStore(activityId, storeIdList, createUser);
    }

    @Override
    public ActivityStore editActivityStore(ActivityStore record, String updateUser) throws BizException {
        return activityStoreManager.editActivityStore(record, updateUser);
    }

    @Override
    public void deleteActivityStore(ActivityStore record, String updateUser) throws BizException {
        activityStoreManager.delete(record, updateUser);
    }

    @Override
    public Boolean isRelationActivity(Integer activityId, Integer storeId) {
        return activityStoreManager.isRelationActivity(activityId, storeId);
    }

    @Autowired
    private ActivityShowStoreManager activityShowStoreManager;

    @Override
    public ActivityShowStore getActivityShowStore(Integer id) {
        return activityShowStoreManager.getActivityShowStore(id);
    }

    @Override
    public Pagination<ActivityShowStore> queryActivityShowStore(String storeName, Integer activityId, Page page) {
        return activityShowStoreManager.queryActivityShowStore(storeName, activityId, page);
    }

    @Override
    public void addActivityShowStore(Integer activityId, List<Integer> storeIdList, String createUser) throws BizException {
        activityShowStoreManager.addActivityShowStore(activityId, storeIdList, createUser);
    }

    @Override
    public void delActivityShowStore(ActivityShowStore record, String updateUser) throws BizException {
        activityShowStoreManager.delActivityShowStore(record, updateUser);
    }

    @Override
    public Boolean isRelationActivityShow(Integer activityId, Integer storeId) {
        return activityShowStoreManager.isRelationActivityShow(activityId, storeId);
    }
}
